package com.wang.extension;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * spring容器扩展点，spring容器初始化之后触发，只会触发一次
 *
 * @Author wly
 * @Date 2018/7/11 13:55
 */
@Component
public class TestBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("spring容器扩展点BeanFactoryPostProcessor，定义Bean的数量：" + beanFactory.getBeanDefinitionCount());
    }
}
